package com.huaxia.day19;

public class StringTest {
    public static void main(String[] args) {
        testString();
    }

    static void testString() {
        String hello = new String("hello,hello");
        char c = hello.charAt(1);
        System.out.println(c);
        System.out.println(hello.length());
        System.out.println(hello.equalsIgnoreCase("hello,HELLO"));
        System.out.println(hello.indexOf("ll"));
        System.out.println(hello.concat("world"));
        System.out.println(hello.split(",")[0]);

        System.out.println(hello.replaceAll("ll", "HH"));
        System.out.println(hello.toUpperCase());
    }

    static void testStringBuffer() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("hello");
        buffer.append(",")
                .append("world")
                .append("!");
        System.out.println(buffer.toString());

        StringBuilder sb = new StringBuilder("hello");
        sb.append(",world");
        System.out.println(sb.toString());
    }


}
